<template>
  <div>
    <div class="table_card">
      <div class="table_card_top">
        <span class="solid_left"></span>
        <div class="table_card_title">分类列表</div>
        <div class="op_right">
          <button class="primary_button" @click="NewSort">添加分类</button>
        </div>
      </div>

      <div class="table_list">
        <el-table :data="tableData" stripe style="width: 100%">
          <el-table-column prop="date" label="排序号" width="300px">
          </el-table-column>
          <el-table-column prop="date" label="分类名称"> </el-table-column>

          <el-table-column prop="date" label="操作" width="200px">
            <el-button size="mini" type="text" @click="EditSort"
              >编辑</el-button
            >
            <span class="separate_right">|</span>
            <el-button size="mini" type="text" @click="DelSort">删除</el-button>
          </el-table-column>
        </el-table>
        <pagination
          :total="total"
          :page.sync="queryParams.pageNo"
          :limit.sync="queryParams.pageSize"
        />
        <!-- @pagination="getList" -->
      </div>

      <!-- 添加分类 -->
      <el-dialog
        :visible.sync="projectSortdialogVisible"
        width="400px"
        :title="title"
        class="no-dialog-padding"
      >
        <span>
          <div class="source_box">
            <el-form
              ref="projectSortForm"
              :rules="projectSortRules"
              :model="projectSortForm"
            >
              <el-row>
                <el-form-item label="排序号" prop="reason">
                  <el-input
                    placeholder="请输入排序号"
                    v-model="projectSortForm.reason"
                  />
                </el-form-item>
              </el-row>
              <el-row>
                <el-col>
                  <el-form-item label="分类名称" prop="name">
                    <el-input
                      class="w-100"
                      v-model="projectSortForm.sex"
                      placeholder="请输入分类名称"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>
        </span>
        <span slot="footer" class="dialog-footer">
          <el-button class="cancel_btn" @click="CancelSourceSubmit"
            >取 消</el-button
          >
          <el-button type="primary" @click="SourceSubmit">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>
        
        <script>
export default {
  name: "EryuoaStoreFrontendClientlist",

  data() {
    return {
      newClientdialogVisible: false, // 新增客户
      MemberInfodialogVisible: false, // 客户信息
      projectSortdialogVisible: false, // 项目分类

      activeIndex: 1,
      form: {
        name: "",
      },

      title: "",
      textarea: "",
      value1: "",
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],

      // options: [
      //   {
      //     value: "选项1",
      //     label: "黄金糕",
      //   },
      // ],

      newClientRules: {
        name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
        iphone1: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
        password: [
          { required: true, message: "请输入6位数消费密码", trigger: "blur" },
        ],
        sex: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
        source: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
      },

      MemberdialogRules: {
        name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
        sex: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
      },

      RechargeRules: {
        name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
        sex: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
      },

      balanceRules: {
        name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
        sex: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
      },

      projectSortRules: {
        name: [{ required: true, message: "请输入排序号", trigger: "blur" }],
        reason: [{ required: true, message: "请输入分类名称", trigger: "blur" }],
      },

      expirationRules: {
        name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
        radio: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
        textarea: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
      },

      newClientForm: {
        name: "",
        iphone1: "",
        iphone2: "",
        password: "",
        sex: "",
        birthday: "",
        member: "",
        source: "",
      },

      balanceForm: {
        name: "",
        sex: "",
      },

      // 会员充值
      MemberdialogForm: {
        name: "",
        sex: "",
      },

      // 办卡充值
      RechargeForm: {
        name: "",
        sex: "",
      },

      // 修改密码
      projectSortForm: {
        name: "",
        reason: "",
      },

      // 修改有效期
      expirationForm: {
        name: "",
        sex: "",
        radio: "1",
        textarea: "",
      },

      value: "",
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
      },
      queryParams1: {
        pageNo: 1,
        pageSize: 10,
      },
      queryParams2: {
        pageNo: 1,
        pageSize: 10,
      },
      total: 0,
      total1: 0,
      total2: 0,
    };
  },

  mounted() {},

  methods: {
    Copy() {},
    CancelSourceSubmit() {
      this.projectSortdialogVisible = false;
    },

    SourceSubmit() {
      this.projectSortdialogVisible = false;
    },

    // 新建来源
    NewSort() {
      this.projectSortdialogVisible = true;
      this.title = "添加分类";
    },

    // 编辑来源
    EditSort() {
      this.projectSortdialogVisible = true;
      this.title = "编辑分类";
    },

    // 删除来源
    DelSort() {
      this.DeleteSort();
    },

    DeleteSort() {
      this.$confirm("分类删除后无法撤销, 是否删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },

    rest() {
      //   this.queryParams.deptId = undefined;
      //   this.queryParams.mobile = "";
    },

    // handleClose(done) {
    //   this.$confirm("确认关闭？")
    //     .then((_) => {
    //       done();
    //     })
    //     .catch((_) => {});
    // },

    // 新增客户 弹框 确认
    ClientSubmit() {
      this.$refs["newClientForm"].validate((valid) => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    // 取消 弹框 关闭
    CancelClientSubmit() {
      this.newClientdialogVisible = false;
    },
  },
};
</script>
        
        <style lang="scss" scoped>
.w-200 {
  width: 200px;
  background: #ffffff;
  border-radius: 4px;
}

.client_name {
  font-size: 14px;
  font-weight: 400;
  color: #0052d9;
}

.give {
  height: 40px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.85);
  margin-top: 40px;
  line-height: 40px;
}

.el-form-item {
  margin-bottom: 20px;
}

.recharge_form {
  padding: 10px 24px;
}

.memberName {
  font-size: 14px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.85);
}
.el_row_item {
  margin-bottom: 10px;
}
.el_row_date {
  margin-top: 20px;
}
.el_row_reason {
  margin-top: 10px;
}

.el_row_date {
  .el-form-item {
    margin-bottom: 0px;
  }
}
.separate_right {
  width: 1px;
  height: 14px;
  // background: #e9e9e9;
  margin-left: 12px;
  margin-right: 12px;
}

.source_box {
  margin: 0 24px;
}
</style>